home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / d / dropsy.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  4.9 KB  |  100 lines

  1. ;DROPSY TEXT effect for Nowhere Man's VCL - TASM will assemble as is using
  2.  
  3. ;VCL recommended switches.  When screen is thoroughly dropsie'd, that is all
  4.  
  5. ;letters have fallen to a single line across the bottom of the monitor,
  6.  
  7. ;the routine will exit to DOS and restore the command prompt. I excerpted
  8.  
  9. ;quite a bit of this from some public domain video routines optimized for
  10.  
  11. ;the accursed a86 assembler and reworked the whole magilla until TASM
  12.  
  13. ;wouldn't choke when swallowing the source. It attempts to meet 
  14.  
  15. ;minimum requirements for VCL formatting. Heck, this is a nice routine
  16.  
  17. ;to have at your fingertips; you gotta admit a CASCADE-virus-like effect 
  18.  
  19. ;is always something people wanna see. And it's commented up the 
  20.  
  21. ;kazoo, one of the features I like best about VCL code. Hope you find
  22.  
  23. ;it useful. -URNST KOUCH
  24.  
  25.  
  26.  
  27. code           segment byte public
  28.  
  29.                assume  cs:code,ds:code,es:code,ss:code
  30.  
  31.                org     0100h
  32.  
  33.  
  34.  
  35.                jmp  Start
  36.  
  37.  
  38.  
  39. main           proc near
  40.  
  41.  
  42.  
  43. Row            dw   24             ;Rows to do initially
  44.  
  45.  
  46.  
  47.                                    ;First, get current video mode and page.
  48.  
  49. Start:         mov  cx,0B800h      ;color display, color video mem for page 1
  50.  
  51.                mov  ah,15          ;Get current video mode
  52.  
  53.                int  10h
  54.  
  55.                cmp  al,2           ;Color?
  56.  
  57.                je   A2             ;Yes
  58.  
  59.                cmp  al,3           ;Color?
  60.  
  61.                je   A2             ;Yes
  62.  
  63.                cmp  al,7           ;Mono?
  64.  
  65.                je   A1             ;Yes
  66.  
  67.                int  20h            ;No,quit
  68.  
  69.  
  70.  
  71.                                    ;here if 80 col text mode; put video segment in ds.
  72.  
  73. A1:            mov  cx,0A300h      ;Set for mono; mono videomem for page 1
  74.  
  75. A2:            mov  bl,0           ;bx=page offset
  76.  
  77.                add  cx,bx          ;Video segment
  78.  
  79.                mov  ds,cx          ;in ds
  80.  
  81.  
  82.  
  83.                                    ;start dropsy effect
  84.  
  85.                xor  bx,bx          ;Start at top left corner
  86.  
  87. A3:            push bx             ;Save row start on stack
  88.  
  89.                mov  bp,80          ;Reset column counter
  90.  
  91.                                    ;Do next column in a row.
  92.  
  93. A4:            mov  si,bx          ;Set row top in si
  94.  
  95.                mov  ax,[si]        ;Get char & attr from screen
  96.  
  97.                cmp  al,20h         ;Is it a blank?
  98.  
  99.                je   A7             ;Yes, skip it
  100.  
  101.                mov  dx,ax          ;No, save it in dx
  102.  
  103.                mov  al,20h         ;Make it a space
  104.  
  105.                mov  [si],ax        ;and put on screen
  106.  
  107.                add  si,160         ;Set for next row
  108.  
  109.                mov  di,cs:Row      ;Get rows remaining
  110.  
  111. A5:            mov  ax,[si]        ;Get the char & attr from screen
  112.  
  113.                mov  [si],dx        ;Put top row char & attr there
  114.  
  115. A6:            call Vert           ;Wait for 2 vert retraces
  116.  
  117.                mov  [si],ax        ;Put original char & attr back
  118.  
  119.                                    ;Do next row, this column.
  120.  
  121.               add  si,160          ;Next row
  122.  
  123.               dec  di              ;Done all rows remaining?
  124.  
  125.               jne  A5              ;No, do next one
  126.  
  127.               mov  [si-160],dx     ;Put char & attr on line 25 as junk
  128.  
  129.                                    ;Do next column on this row.
  130.  
  131. A7:           add  bx,2            ;Next column, same row
  132.  
  133.               dec  bp              ;Dec column counter; done?
  134.  
  135.               jne  A4              ;No, do this column
  136.  
  137. ;Do next row.
  138.  
  139. A8:           pop  bx              ;Get current row start
  140.  
  141.               add  bx,160          ;Next row
  142.  
  143.               dec  cs:Row          ;All rows done?
  144.  
  145.               jne  A3              ;No
  146.  
  147. A9:           mov  ax,4C00h  
  148.  
  149.               int  21h             ;Yes, quit to DOS with error code
  150.  
  151.  
  152.  
  153.                                    ;routine to deal with snow on CGA screen.
  154.  
  155. Vert:         push ax
  156.  
  157.               push dx
  158.  
  159.               push cx              ;Save all registers used
  160.  
  161.               mov  cl,2            ;Wait for 2 vert retraces
  162.  
  163.               mov  dx,3DAh         ;CRT status port
  164.  
  165. F1:           in   al,dx           ;Read status
  166.  
  167.               test al,8            ;Vert retrace went hi?
  168.  
  169.               je   F1              ;No, wait for it
  170.  
  171.               dec  cl              ;2nd one?
  172.  
  173.               je   F3              ;Yes, write during blanking time
  174.  
  175. F2:           in   al,dx           ;No, get status
  176.  
  177.               test al,8            ;Vert retrace went low?
  178.  
  179.               jne  F2              ;No, wait for it
  180.  
  181.               jmp  F1              ;Yes, wait for next hi
  182.  
  183. F3:           pop  cx
  184.  
  185.               pop  dx
  186.  
  187.               pop  ax              ;Restore registers
  188.  
  189.               ret                  ;and return
  190.  
  191.               
  192.  
  193.               main   endp
  194.  
  195.               code   ends
  196.  
  197.               end    main
  198.  
  199.